home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / 273_01.zip / INDEX.CC < prev    next >
Text File  |  1993-04-04  |  447b  |  13 lines

  1. #include <stdlib.h>
  2. char *index(char *str, char c)
  3. /*------------------------------------------------------------------------------
  4. INDEX - returns a pointer to the first occurance of 'c' in the string pointed
  5. to by 'str', or NULL if 'str' does not contain 'c'.
  6. ------------------------------------------------------------------------------*/
  7. {
  8.  while( (*str != c) && *(str++) );
  9.  if( *str == c )
  10.    return( str );
  11.  return( NULL );
  12. }
  13.